home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / sys / resource.h < prev    next >
C/C++ Source or Header  |  1995-02-14  |  4KB  |  157 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * Copyright (c) 1987 Carnegie-Mellon University
  6.  * All rights reserved.  The CMU software License Agreement specifies
  7.  * the terms and conditions for use and redistribution.
  8.  */
  9. /*
  10.  * HISTORY
  11.  * $Log:    resource.h,v $
  12.  * 27-Sep-89  Morris Meyer (mmeyer) at NeXT
  13.  *    Sun Bugfixes: 1009246 - Comments on some fields were wrong.
  14.  *
  15.  * Revision 2.7  89/03/09  22:07:10  rpd
  16.  *     More cleanup.
  17.  * 
  18.  * Revision 2.6  89/02/25  17:55:54  gm0w
  19.  *     Made CMUCS conditionals always true.
  20.  *     [89/02/14            mrt]
  21.  * 
  22.  * Revision 2.5  88/10/11  12:08:31  rpd
  23.  *     Added include of time.h since this file uses 
  24.  *     struct timeval.
  25.  *     [88/10/11  11:41:22  rpd]
  26.  * 
  27.  * Revision 2.4  88/08/24  02:41:41  mwyoung
  28.  *     Adjusted include file references.
  29.  *     [88/08/17  02:21:30  mwyoung]
  30.  * 
  31.  * Revision 2.3  88/08/22  21:29:44  mja
  32.  *     Add RUSAGE_NODEV definition.
  33.  *     [88/08/11  19:18:02  mja]
  34.  * 
  35.  * Revision 2.2  88/07/15  15:59:57  mja
  36.  * Condensed local conditionals.
  37.  * 
  38.  * 06-Jan-88  Jay Kistler (jjk) at Carnegie Mellon University
  39.  *    Made file reentrant.  Added declarations for __STDC__.
  40.  *
  41.  * 28-Jan-87  Mike Accetta (mja) at Carnegie-Mellon University
  42.  *    CMUCS: Defined new rusage_dev structure for special
  43.  *    wait3() option;
  44.  *    CMUCS: Added RPAUSE definitions.
  45.  *    [ V5.1(F1) ]
  46.  *
  47.  */
  48. /*
  49.  * Copyright (c) 1982, 1986 Regents of the University of California.
  50.  * All rights reserved.  The Berkeley software License Agreement
  51.  * specifies the terms and conditions for redistribution.
  52.  *
  53.  *    @(#)resource.h    7.1 (Berkeley) 6/4/86
  54.  */
  55.  
  56. #ifndef    _SYS_RESOURCE_H_
  57. #define _SYS_RESOURCE_H_
  58.  
  59. #ifdef    ASSEMBLER
  60. #else    ASSEMBLER
  61. #import <sys/time.h>
  62. #import <sys/types.h>
  63.  
  64. /*
  65.  * Process priority specifications to get/setpriority.
  66.  */
  67. #define PRIO_MIN    -20
  68. #define PRIO_MAX    20
  69.  
  70. #define PRIO_PROCESS    0
  71. #define PRIO_PGRP    1
  72. #define PRIO_USER    2
  73.  
  74. /*
  75.  * Resource utilization information.
  76.  */
  77.  
  78. #define RUSAGE_SELF    0
  79. #define RUSAGE_CHILDREN    -1
  80.  
  81. struct    rusage {
  82.     struct timeval ru_utime;    /* user time used */
  83.     struct timeval ru_stime;    /* system time used */
  84.     long    ru_maxrss;
  85. #define ru_first    ru_ixrss
  86.     long    ru_ixrss;        /* XXX: 0 */
  87.     long    ru_idrss;        /* XXX: sum of rm_asrss */
  88.     long    ru_isrss;        /* XXX: 0 */
  89.     long    ru_minflt;        /* any page faults not requiring I/O */
  90.     long    ru_majflt;        /* any page faults requiring I/O */
  91.     long    ru_nswap;        /* swaps */
  92.     long    ru_inblock;        /* block input operations */
  93.     long    ru_oublock;        /* block output operations */
  94.     long    ru_msgsnd;        /* messages sent */
  95.     long    ru_msgrcv;        /* messages received */
  96.     long    ru_nsignals;        /* signals received */
  97.     long    ru_nvcsw;        /* voluntary context switches */
  98.     long    ru_nivcsw;        /* involuntary " */
  99. #define ru_last        ru_nivcsw
  100. };
  101.  
  102. /*
  103.  * Resource limits
  104.  */
  105. #define RLIMIT_CPU    0        /* cpu time in milliseconds */
  106. #define RLIMIT_FSIZE    1        /* maximum file size */
  107. #define RLIMIT_DATA    2        /* data size */
  108. #define RLIMIT_STACK    3        /* stack size */
  109. #define RLIMIT_CORE    4        /* core file size */
  110. #define RLIMIT_RSS    5        /* resident set size */
  111.  
  112. #define RLIM_NLIMITS    6        /* number of resource limits */
  113.  
  114. #define RLIM_INFINITY    0x7fffffff
  115.  
  116. struct rlimit {
  117.     int    rlim_cur;        /* current (soft) limit */
  118.     int    rlim_max;        /* maximum value for rlim_cur */
  119. };
  120.  
  121.  
  122. /*
  123.  *  Special rusage structure returned with WLOGINDEV option to wait3().
  124.  */
  125.  
  126. struct rusage_dev {
  127.     struct rusage ru_rusage;
  128.     dev_t          ru_dev;
  129. };
  130.  
  131. #define RUSAGE_NODEV    ((dev_t)-1)    /* same as NODEV */
  132.  
  133.  
  134. /*
  135.  *  Resource pause system call definitions
  136.  */
  137.  
  138. #define RPAUSE_SAME    0        /* leave state unchanged */
  139. #define RPAUSE_DISABLE    1        /* disable pause on error type(s) */
  140. #define RPAUSE_ENABLE    2        /* enable pause on error type(s) */
  141.  
  142. #define RPAUSE_ALL    0x7fffffff    /* all error number types */
  143.  
  144.  
  145. #if    defined(__STDC__) && !defined(KERNEL)
  146. extern int getpriority(int, int);
  147. extern int setpriority(int, int, int);
  148. extern int getrlimit(int, struct rlimit *);
  149. extern int setrlimit(int, struct rlimit *);
  150. extern int getrusage(int, struct rusage *);
  151. #endif    defined(__STDC__) && !defined(KERNEL)
  152.  
  153. #endif    ASSEMBLER
  154. #endif    _SYS_RESOURCE_H_
  155.  
  156.  
  157.